using System.Collections.Generic;
using System;

//bad design just for better performance(using Label directly)
//(IReaderData is designed to be platform independent)
using Sce.PlayStation.HighLevel.UI;


namespace VitaReader
{
	public struct BookInfo
	{
		public String	FileName;	//file name without path on system's filesystem
		public String	FullPath;	//file name with full path
		public String	Title;		//book title, may diff from filename, may be assgined by user later
		public long		Size;		//size in bytes
		public int		LastPos;
		public List<int>	BookMarks;	//book mark of lines

		//per book settings
		/*
		public int		FontSize;
		public long		FontColor;
		public long		BkColor;
		public String	BkImage;
		*/
	};
	
	public enum ReadResult
	{
		OK,
		EOF,
		ERROR,
	};
	
	public struct PagePos
	{
		public int Start;
		public int Size;
		public List<int> LinePos;	//list of stream pos of lines
	};
	
	public interface IReaderData
	{
		#region books property
		//list file path property
		String ListFile				{get;}
		
		//
		String BookPath				{get;}
		
		//
		List<BookInfo> BookList		{get;}
		
		Dictionary<String, BookInfo> BookRegistry	{get;}
		
		BookInfo CurrentBook		{get;set;}
		
		//name of last read
		String LastReadBook			{get;set;}
		#endregion
				
		//
		void	Initialize();
		
		//
		void	Shutdown();
		
		//
		void	RefreshBookInfo();
		
		//
		bool	DeleteBook(String fileName);
		
		//
		bool	OpenFile(String fileName,out BookInfo info);
		
		//temporary method, because currently we cannot copy help file to /Documents/books/
		bool	OpenHelp(String fileName,out BookInfo info);
		
		//
		void	CloseFile();
		
		//read previously opened file
		//text = "" means is the end of beginning
		ReadResult	ReadForwardFile(ref PagePos pagePos, ref Label text);
		
		ReadResult 	ReadBackwardFile(ref PagePos pagePos, ref Label text);
		
		//
		bool	GetBookInfo(String fileName, out BookInfo info);
		
		//
		bool	GetBookText(int pos,int count,ref Label text);
	}
}

